package com.vaadin.tutorial.crm.ui.view.user;

import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.textfield.PasswordField;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.router.Route;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @Description:
 * @Author: Fan
 * @Date: 2021/1/16 17:06
 * @Version 1.0
 */
@Route("user")
public class UserView extends FormLayout {
    private TextField username = new TextField("用户名");
    PasswordField passwordField = new PasswordField("密码");
    public UserView(){
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        username.setValue(auth.getName());
        add(username);
    }
}
